#include <bits/stdc++.h>

using namespace std;

int n, a[200005], k;
bool have = true;

int main()
{
	freopen("fruit.in", "r", stdin);
	freopen("fruit.out", "w", stdout);
	scanf("%d", &n);
	for(int i = 1;i <= n;i++)
	{
		scanf("%d", &a[i]);
	}
	while(have)
	{
		have = false;
		for(int i = 1;i <= n;i++)
		{
			if(a[i] != -1)
			{ 
				have = true;
				printf("%d ", i);
				k = i;
				i++;
				while(a[i] == -1 || a[i] == a[k]) i++;
				i--;
				a[k] = -1;
			}
		}
		if(!have) break;
		printf("\n");
	}
	return 0;
}
